<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.0/css/jquery.dataTables.css"></link>

<script type="text/javascript" language="javascript" src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript" language="javascript" src="//cdn.datatables.net/1.10.0/js/jquery.dataTables.js"></script>

<script type="text/javascript" language="javascript">
jQuery.fn.dataTableExt.oApi.fnGetHiddenNodes = function ( settings )
{
    var nodes;
    var display = jQuery('tbody tr', settings.nTable);
 
    if ( jQuery.fn.dataTable.versionCheck ) {
        // DataTables 1.10
        var api = new jQuery.fn.dataTable.Api( settings );
        nodes = api.rows().nodes().toArray();
    }
    else {
        // 1.9-
        nodes = this.oApi._fnGetTrNodes( settings );
    }
 
    /* Remove nodes which are being displayed */
    for ( var i=0 ; i<display.length ; i++ ) {
        var iIndex = jQuery.inArray( display[i], nodes );
 
        if ( iIndex != -1 ) {
            nodes.splice( iIndex, 1 );
        }
    }
 
    return nodes;
};

$(document).ready(function() {
	oTable = $('#product_table').dataTable({
        "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
    });
	    
	   $('form').submit(function(){
	      $(oTable.fnGetHiddenNodes()).find('input:text').appendTo(this);
	      $(oTable.fnGetHiddenNodes()).find('select').appendTo(this);
	   });
	} );

function discontinus(source){
	var currentId = $(source).attr('id');
	var id = currentId.split("_");
	var checkId = "order_"+id[1];
	
	if(source.checked){
		$('#'+ checkId).prop('value',0);
	}

	
}	
	</script>
</head>
<body>
<?php if($this->check != true){?>
<h1><?php echo $this->orderNo." List Summary"?></h1>
<?php }else{?>
<h1><?php echo $this->orderNo." Has Locked , You may close window"?></h1>
<?php }?>
<form id="form1" name="form1" method="post" action="" enctype="multipart/form-data">

<table width = "1000" border="1" cellspacing="1" cellpadding="5" id="product_table" >
<thead> 
  <tr>
		<th>Barcode</th>
		<th>Description</th>
		<th>Category</th>
		<th>Order Qty</th>
	</tr>
 </thead> 	
 <tbody>
	<?php foreach($this->orderList as $k => $v){?>
	<tr>
		<td><?php echo $v['code_product']?></td>
		<td><?php echo $v['des_product']?></td>
		<td><?php echo $v['status_hot']?></td>
		<?php if($this->check != true){?>
		<td><input type = "text" name = "qty[<?php echo $v['id_order']?>]" value = "<?php echo $v['qty_order']?>" ></input> <span style="display:none"><?php echo $v['qty_order']?></span></td>
		<?php }else{?>
		<td><?php echo $v['qty_order']?></td>
		<?php }?>
	</tr>
	<?php }?>
 
  </tbody>
  
</table>

<br/>
<br/>
<?php if($this->check != true){?>
<input type = "submit" name = "exportcList" value = "General C# List"></input>
<input type = "submit" name = "exportDiscontinue" value = "General Discontinue List"></input>
<input type = "submit" name = "export" id = "next" value = "Submit&Lock Order" style = "margin-left:750px;"></input>
<?php }?>

</form>
</body>
</html>